package com.lantosec.hmrp.modules.system.entity;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.system.vo.SysPermissionVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 系统权限表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysPermission extends BaseEntity<SysPermissionVO> {

    private static final long serialVersionUID = 1L;
    public SysPermission(SysPermissionVO vo){
        this.permissionId = vo.getPermissionId();
        this.permissionName = vo.getPermissionName();
        this.permissionShowName = vo.getPermissionShowName();
        this.parentId = vo.getParentId();
        this.permissionOrder = vo.getPermissionOrder();
        this.state = vo.getState();
    }

    @Override
    public SysPermissionVO convertToVO(){
        return new SysPermissionVO(this);
    }


    /**
     * 权限ID
     */
    @TableId(value = "permission_id", type = IdType.ASSIGN_UUID)
    private String permissionId;

    /**
     * 权限名称(唯一)
     */
    private String permissionName;

    /**
     * 显示名
     */
    private String permissionShowName;

    /**
     * 上级ID
     */
    private String parentId;

    /**
     * 排序
     */
    private Integer permissionOrder;

    /**
     * 状态(0正常,1禁用)
     */
    private Integer state;


    public enum ColName {
        permission_id, permission_name, permission_show_name, parent_id, permission_order, state, 
    }
}
